package main
import (
	"fmt"
	"time"
)
//冒泡排序算法
func main(){
	var array [10]int = [...]int{11,2,42,21,4,64,14,50,91,16}
	fmt.Println(array)
	start := time.Now().UnixNano()
	BubbingSort(&array)
	end := time.Now().UnixNano()
	fmt.Println(array)
	fmt.Println("所用时间：",end - start)
}

func BubbingSort(a *[10]int){
	for i := 0;i < len(a)-1;i++{
		for j:=0;j < len(a)-1-i;j++{
			if a[j] > a[j+1]{
				a[j],a[j+1] = a[j+1],a[j]
			}
		}
	}

}